package at.fhooe.engine.visuals;

import java.awt.Color;
import java.awt.Graphics2D;

public class StarVisual implements Visual {

	private int m_numOfPoints;
	private double m_size;
	private Color m_color;
	
	public StarVisual(Color color, double size) {
		m_size = size;
		m_color = color;
		m_numOfPoints = 10;
	}
	
	@Override
	public void draw(Graphics2D graphics) {
		
		int[] xPoints = new int[m_numOfPoints];
		int[] yPoints = new int[m_numOfPoints];
		
		xPoints[0] = (int) (1.68 * m_size);
		xPoints[1] = (int) (0.52 * m_size);
		xPoints[2] = 0;
		xPoints[3] = (int) (-0.52 * m_size);
		xPoints[4] = (int) (-1.68 * m_size);
		xPoints[5] = (int) (-0.84 * m_size);
		xPoints[6] = (int) (-1.04 * m_size);
		xPoints[7] = 0;
		xPoints[8] = (int) (1.04 * m_size);
		xPoints[9] = (int) (0.84 * m_size);
		
		yPoints[0] = (int) (0.38 * m_size);
		yPoints[1] = (int) (0.55 * m_size);
		yPoints[2] = (int) (1.6 * m_size);
		yPoints[3] = (int) (0.55 * m_size);
		yPoints[4] = (int) (0.38 * m_size);
		yPoints[5] = (int) (-0.44 * m_size);
		yPoints[6] = (int) (-1.6 * m_size);
		yPoints[7] = (int) (-1.05 * m_size);
		yPoints[8] = (int) (-1.6 * m_size);
		yPoints[9] = (int) (-0.44 * m_size);
		
		graphics.setColor(m_color);
		graphics.fillPolygon(xPoints, yPoints, m_numOfPoints);
	}

}
